﻿using BigEgg.Framework.Foundation;
using BigEgg.Framework.UnitTesting;
using FMStudio.Domain.Properties;
using FMStudio.Domain.SQLite;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Globalization;

namespace FMStudio.Domain.SQLite.Test
{
    [TestClass]
    public class TrademarkTest
    {
        [TestMethod]
        public void GeneralTrademarkTest()
        {
            Trademark trademark = new Trademark();

            Assert.IsNotNull(trademark.ID);
            Assert.AreEqual("", trademark.Name);

            trademark.Name = "Coca cola";

            Assert.AreEqual("", trademark.Validate());
        }

        [TestMethod]
        public void TrademarkNameValidationTest()
        {
            Trademark trademark = new Trademark();

            Assert.AreEqual(string.Empty, trademark.Name);
            Assert.AreEqual(Resources.TrademarkNameMandatory, trademark.Validate("Name"));

            trademark.Name = TestHelper.CreateString('A', 99);
            Assert.AreEqual("", trademark.Validate("Name"));
            trademark.Name = TestHelper.CreateString('A', 100);
            Assert.AreEqual("", trademark.Validate("Name"));
            trademark.Name = TestHelper.CreateString('A', 101);
            Assert.AreEqual(
                string.Format(CultureInfo.CurrentCulture, Resources.TrademarkNameMaxLength, "Name", 100)
                , trademark.Validate("Name"));
        }
    }
}
